package com.ywgt.utils;

import java.util.concurrent.CountDownLatch;

public class CountDownLunchTest {
    public static void main(String[] args) throws InterruptedException {
        //计数器
        CountDownLatch countDownLatch=new CountDownLatch(6);
        for (int i=0 ;i<6;i++){
         new Thread(()->{
             System.out.println(Thread.currentThread().getName()+"goOut");
             countDownLatch.countDown();//减数
         },String.valueOf(i)).start();
        }
        //倒计
        countDownLatch.await();//等待计时完成
        System.out.println("close");
    }
}
